package day04;

/**
 * @author Xiao
 * @date 2021/7/3
 */
/*
	获取最值
        获取数组中的最大值
		已知数组的元素为 {12, 45, 98, 73, 60};
*/
public class Test01 {
    public static void main(String[] args) {
        int[] arr = {12, 45, 98, 73, 60};
        System.out.println("初始数组如下：");
        System.out.print("[");
        for (int i = 0; i < arr.length; i++) {
            if (i == arr.length - 1) {
                System.out.println(arr[i] + "]");
            } else {
                System.out.print(arr[i] + ", ");
            }
        }
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
        }
        System.out.println("max:" + max);
    }
}
